package com.diandi.ddsb.bean;

/**
 * 
 * 签到类型
 * 
 * @author liuxu
 * @since 2016年10月31日
 *
 */
public enum SignActivityType {
	ONE_DAY_SIGN(1, "日常签到"), CONSTANT_SIGN(2, "连续签到");

	/**
	 * value
	 */
	private final String text;
	/**
	 * key
	 */
	private final int value;

	SignActivityType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public static SignActivityType getTextByValue(int value) {
		for (SignActivityType item : SignActivityType.values()) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new RuntimeException(value + "不是合法的类型！");
	}

	public static SignActivityType getValueByText(String text) {
		for (SignActivityType item : SignActivityType.values()) {
			if (item.getText().equals(text)) {
				return item;
			}
		}
		throw new RuntimeException(text + "不是合法的类型！");
	}

	public String getText() {
		return text;
	}

	public int getValue() {
		return value;
	}
}
